package embuzzled.g5;

import java.awt.Color;
import java.awt.Point;
import java.util.ArrayList;

import embuzzled.ui.Grid;
import embuzzled.ui.GridSolution;
import embuzzled.ui.Player;

public class G5Player implements Player{
	
	/**
	 * Random number handling.
	 * Set USE_SEED to true to initialize the random instance with the seed SEED.
	 * Set USE_SEED to false to use the default Random constructor.
	 */
	//public static boolean USE_SEED = false;
	public static long SEED = 438777320L;

	public GridSolution move(Grid grid) {
		
		//System.out.println("Move");
		
		Helper.initializeRandom(SEED);
		
		/* Initialize grid, puzzles. Populate grid with puzzles. */
		PuzzleGrid g = new PuzzleGrid(grid);
		PuzzleSet g5Puzzles = new G5Puzzles();
		g.populate(g5Puzzles);
		
		//System.out.println("Puzzles placed");
		
		/* Create a solution */
        //throw new UnsupportedOperationException("Not supported yet.");
        int rows = grid.rows;
        int cols = grid.cols;
        int no_of_puz = g.numPuzzles;
        String SolutionKey = g.solution;
        
        //System.out.println("Making background...");
        
        /* Create a background */
        Color[][] gridWithBG = Helper.superimposeWithBackground(g.grid, 2);
        
        GridSolution NotDumbSolution = new GridSolution(rows, cols, no_of_puz,SolutionKey);
        NotDumbSolution.GridColors = gridWithBG;
        
        //System.out.println("Returning solution");
       
        //System.out.println("I was called");
        return NotDumbSolution;

    }

}

